package top.buyibuyi.course.dao;

import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;
import top.buyibuyi.course.pojo.ChooseCourse;
import top.buyibuyi.course.pojo.Classroom;

import java.util.List;

@Mapper
public interface SelectTeacherCourse {

    @Results({
            @Result(column = "classroomn",property = "classroomn"),
            @Result(column = "classroomn",property = "classroom", one = @One(select = "top.buyibuyi.course.dao.SelectTeacherCourse.selectClassroomByn",fetchType = FetchType.LAZY))
    })
    @Select("select * from choosecourse where ajobn = #{ajobn}")
    List<ChooseCourse> selectChooseCourseByAjobn(int ajobn);

    @Results({
            @Result(column = "fnum",property = "fnum"),
            @Result(column = "fnum",property = "classroom", one = @One(select = "top.buyibuyi.course.dao.SelectTeacherCourse.selectClassroomByFnum",fetchType = FetchType.LAZY))
    })
    @Select("select * from classroom where id = #{classroomn}")
    Classroom selectClassroomByn(int classroomn);


    @Select("select * from classroom where id = #{fnum}")
    Classroom selectClassroomByFnum(int fnum);
}
